package com.olt.domain.oltCenter.problem;

import java.util.LinkedHashMap;
import java.util.Map;

//此工厂用于实例化对象
public class ProblemFactory {
    Map<Integer,Class<? extends ProblemAbstract>> maps=new LinkedHashMap<>();

    public void Register(Integer type,Class<? extends ProblemAbstract> t){
        maps.put(type,t);
    }

    public Class<? extends ProblemAbstract> getClassByType(Integer t){
        return maps.get(t);
    }

    //注册
    private ProblemFactory(){
        Register(ProblemType.SELECT,SelectProblem.class);

        Register(ProblemType.BLANKS,BlanksProblem.class);

        Register(ProblemType.SUBJECTIVE,SubjectiveProblems.class);

        Register(ProblemType.PROGRAM,ProgramProblem.class);



    }

    private static final ProblemFactory PROBLEM_FACTORY=new ProblemFactory();


    public static  ProblemFactory getInstance(){
        return PROBLEM_FACTORY;
    }


}
